#pragma once

#include  "iostream"
#include  "vector"
#include  "stack"
#include  "unordered_map"
#include   "queue"

using namespace std;

struct Nodes {
    Nodes *next;
    int val;
    int key;
};

vector<Nodes> mp(10);

void put(int key, int value) {
    int left = key % 10;
    auto temp = mp[left].next;

    while (temp) {
        if (temp->key == key) {
            temp->val = value;
            return;
        }
        temp = temp->next;
    }

    auto n = new Nodes;
    n->key = key;
    n->val = value;
    n->next = mp[left].next;
    mp[left].next = n;

}

int get(int key) {
    int left = key % 10;
    auto temp = mp[left].next;

    while (temp) {
        if (temp->key == key)
            return temp->val;
        temp = temp->next;
    }

    return -1;
}

void remove(int key) {

    int left = key % 10;
    auto temp = mp[left].next;

    if (temp && temp->val == key) {
        mp[left].next = temp->next;
        return;
    }

    Nodes *pre = temp;
    while (temp) {
        if (temp->key == key) {
            temp->val = -1;
            pre->next = temp->next;
        }

        temp = temp->next;

    }


}